home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / Word5.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  8.8 KB  |  234 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        Word5.vu
  5. #
  6. #    Contains:    Quick look test script for Word version 5.0
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.8>    12/14/93    KTA        Added wait after selecting the print preview menu to allow
  19. #                                    dialog to appear.
  20. #     <1.0.7>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  21. #                                    launchTwitch().
  22. #     <1.0.6>     9/23/93    KTA        The WordProcessor.Lib was not defined as a dependancy.
  23. #     <1.0.5>     9/22/93    KTA        Changed gDismissSFPut to gSaveAsHook3
  24. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  25. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  26. #
  27. # ****************************************************************************
  28. #
  29.  
  30.  
  31.  
  32. ########################################################################
  33. #                            External libraries 
  34. #=======================================================================
  35. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib", "WordProcessor.Lib";
  36.  
  37.  
  38. #########################################################################
  39. ########               Application Specific Tasks
  40. #########################################################################
  41.  
  42.  
  43. #########################################################################
  44. #                        InitAppGlobals()
  45. #========================================================================
  46. # Author:        ML
  47. # Description:    Sets up the app's globals.
  48. # Parameters:    None
  49. # Returns:        Nothing
  50. # Application:    Word
  51. # Examples:        InitAppGlobals()
  52. #========================================================================
  53. # History:
  54. #
  55. ########################################################################
  56. task InitAppGlobals()
  57. begin
  58.  
  59.     logstr("setting up {global gApptitle}'s globals");            
  60.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  61.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  62. #        global kTabPaletteNum := 1; 
  63. #        global kAlignPaletteNum := 2;
  64. #        global kSpacingPaletteNum := 3;
  65. #        global kParSpacePaletteNum := 4;
  66.  
  67. #        global gPaletteList :=    {
  68. #                                {                        #### Start Palette #1 - Tabs
  69. #                                {121, 48, 217, 57,0},    # Location of tab palette relative to the window
  70. #                                kPalDocWind,            # Palette type
  71. #                                {5,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  72. #                                {19,8},                    # Offset between tools {h,v}
  73. #                                0,                        # Not used at this time
  74. #                                0                        # Not used at this time
  75. #                                },                        #### End Palette #1
  76. #                                {                        #### Start Palette #2 - Alignment
  77. #                                {231, 48, 307, 57,0},        # Location of alignment palette relative to the window
  78. #                                kPalDocWind,            # Palette type
  79. #                                {4,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  80. #                                {19,8},                    # Offset between tools {h,v}
  81. #                                0,                        # Not used at this time
  82. #                                0                        # Not used at this time
  83. #                                },                        #### End Palette #2
  84. #                                {                        #### Start Palette #3 - Line spacing
  85. #                                {321, 48, 377, 57,0},        # Location of Line spacing palette relative to the window
  86. #                                kPalDocWind,            # Palette type
  87. #                                {3,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  88. #                                {19,8},                    # Offset between tools {h,v}
  89. #                                0,                        # Not used at this time
  90. #                                0                        # Not used at this time
  91. #                                },                        #### End Palette #3
  92. #                                {                        #### Start Palette #4 - Paragraph spacing
  93. #                                {391, 48, 427, 57,0},        # Location of Line Paragraph spacing palette relative to the window
  94. #                                kPalDocWind,            # Palette type
  95. #                                {2,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  96. #                                {19,8},                    # Offset between tools {h,v}
  97. #                                0,                        # Not used at this time
  98. #                                0                        # Not used at this time
  99. #                                }                        # End Palette #4
  100. #        };
  101. #    
  102. #        ### Word                                                                            {Flag, Pattern, Line, Color}
  103. #        ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  104. #        global TabLeftTool :=         { 1,  1,        "Tab Left",        kClick, 0,                {0}                };
  105. #        global TabCenterTool :=     { 2,  1,        "Tab Center",    kClick, 0,                {0}                };
  106. #        global TabRightTool :=         { 3,  1,        "Tab Right",    kClick, 0,                {0}                };
  107. #        global TabDecimalTool :=     { 4,  1,        "Tab Decimal",    kClick, 0,                {0}                };
  108. #        global TabVerticalTool :=     { 5,  1,        "Tab Vertical",    kClick, 0,                {0}                };
  109. #        global AlignLeftTool :=     { 1,  2,        "Align Left",    0,         0,                {0}                };
  110. #        global AlignCenterTool :=     { 2,  2,        "Align Center",    0,         0,                {0}                };
  111. #        global AlignRightTool :=     { 3,  2,        "Align Right",    0,         0,                {0}                };
  112. #        global AlignLRTool :=         { 4,  2,        "Align LR",        0,         0,                {0}                };
  113. #        global SingleSpaceTool :=     { 1,  3,        "Single Space",    0,         0,                {0}                };
  114. #        global xSpaceTool :=         { 2,  3,        "1-1/2 Space",    0,         0,                {0}                };
  115. #        global DoubleSpaceTool :=     { 3,  3,        "Double Space",    0,         0,                {0}                };
  116. #        global NoParSpaceTool :=     { 1,  4,        "No Par Space",    0,         0,                {0}                };
  117. #        global ParSpaceTool :=         { 2,  4,        "Par Space",    0,         0,                {0}                };
  118. #    
  119. #        # global Tool list
  120. #    
  121. #        global RulerRect:= {17,32,20,43};
  122. #        global gWindowInset := {0,0,0,0};
  123. #        
  124. #        global TabToolList:={    TabLeftTool,
  125. #                                TabCenterTool,
  126. #                                TabRightTool,
  127. #                                TabDecimalTool,
  128. #                                TabVerticalTool
  129. #        };
  130. #    
  131. #        global OtherToolList:={    AlignLeftTool,
  132. #                                AlignCenterTool,
  133. #                                AlignRightTool,
  134. #                                AlignLRTool,
  135. #                                SingleSpaceTool,
  136. #                                xSpaceTool,
  137. #                                DoubleSpaceTool,
  138. #                                NoParSpaceTool,
  139. #                                ParSpaceTool
  140. #        };
  141.  
  142. #      The above is the tool setup for Word 4.0.  It needs to be revised for 5.0.
  143.  
  144.     global RulerMenuPath := {'Ruler','View'};
  145.     
  146.         ### font characteristic lists
  147.     global gFontSizeList := {'9','10','12','14','18', '24'};
  148.     global gFontStyleList := {'Bold','Italic','Underline'};
  149.  
  150.         ### Name of the Plain (style) menu item  ####
  151.     global gPlainStyle := "Plain Text";            # Plain-Style menu item
  152.  
  153.         ### How to get to the next line
  154.     global gNextLineMethod := 4;            
  155.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  156.     
  157.         ### Does moving to the next line clear all font info
  158.     global gNextLineClearsFontSettings := 0;
  159.  
  160. end;    #InitAppGlobals
  161.  
  162. #########################################################################
  163. #                        Views()
  164. #========================================================================
  165. # Author:        ML
  166. # Description:    Change Views. 
  167. # Parameters:    None
  168. # Returns:        Nada
  169. # Application:    Word
  170. # Examples:        Views();
  171. #========================================================================
  172. # History:
  173. #
  174. ########################################################################
  175. task Views() 
  176. begin
  177.     LogStr( "    Changing Views    ");
  178.     SelectMenuItem("Print Preview", "File");
  179.     wait(3);
  180.     selectButton('Page Layout');
  181.     Println;
  182. end;
  183.  
  184. #########################################################################
  185. #                        WordSummaryHandler()
  186. #========================================================================
  187. # Author:        ML
  188. # Description:    Handle the Word summary window. 
  189. # Parameters:    None
  190. # Returns:        Nada
  191. # Application:    Word
  192. # Examples:        WordSummaryHandler();
  193. #========================================================================
  194. # History:
  195. #
  196. ########################################################################
  197. task WordSummaryHandler() 
  198. begin
  199.     if match [window t:'Summary Info' o:1]!    # if summary window is frontmost
  200.         SpecialKey(ReturnKey, 'Return Key');# dismiss it
  201. end;
  202.  
  203. ################################################################################
  204. ####################             Main script                    ####################
  205. ################################################################################
  206. script Word (ScriptLevel:= -1)
  207. begin
  208.     InitGlobals(ScriptLevel);                    
  209.     InitDraw();
  210.     InitFonts();
  211.     global gAppTitle := 'Microsoft Word';
  212.     global gAppVersion := '5.1';
  213.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  214.     SuiteStart('Word5.vu');                                    # begin a new test suite
  215.     if LaunchTwitch("{gAppTitle}",gAliasDirectory)    # launch or twitch to your app
  216.     begin
  217.         global gSaveAsHook3 := task WordSummaryHandler;    
  218.         InitAppGlobals();
  219.         (*
  220.         *)
  221.         DoSetUpApp(,,,,1,1);
  222.         DoText();
  223.         if (gAppTestLevel = 2)
  224.             DoWPTools();    # ruler tools need to be set up for 5.0
  225.         DoWindow();
  226.         Views();
  227.         DoCloseApp(,'Cancel');
  228.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  229.     SuiteEnd();
  230. end;
  231.  
  232. ### What's Needed
  233. #    1) Set up Ruler tools for 5.0
  234. #    2) insure we've got full menus